﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["userid"] != null)
            {
                usrNameLabel.Text = Session["userid"].ToString();
                binddata();
            }
            else
            {
                Response.Write("<script type=\"text/javascript\">top.location.href=\"login.aspx\";</script>");
            }
            //Lel4.Text = (DateTime.Now).ToString();
            
        }
    }
    protected void binddata()
       {
           string str = "SELECT unit_id FROM opeartorman WHERE (no = '" + Session["userid"].ToString() + "')";
           SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["medical"].ConnectionString);
           con.Open();
           SqlCommand cmd = new SqlCommand(str, con);
           deptCntLabel.Text = (cmd.ExecuteScalar()).ToString();
           con.Close();
       }
      

    protected void bton_Click(object sender, EventArgs e)
    {
        Session["userid"] = null;
        //Response.Redirect("index1.aspx");
        Response.Write("<script type=\"text/javascript\">top.location.href=\"login.aspx\";</script>");
    }
    protected void btoff_Click(object sender, EventArgs e)
    {
        Response.Write("<script type=\"text/javascript\">window.open('changepassword.aspx','tlframe2');</script>");
    }
}
